package com.xgst.runningmanager

import android.os.Bundle
import android.view.View
import com.blankj.utilcode.util.ActivityUtils
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.xgst.baselib.BaseActivity
import com.xgst.runningmanager.databinding.ActivityVideoBinding

class VideoActivity:BaseActivity<ActivityVideoBinding>() {

   companion object{
       fun startActivity(url:String){
           val bundle = Bundle()
           bundle.putString("videoUrl",url)
           ActivityUtils.startActivity(bundle,VideoActivity::class.java)
       }
   }

    override fun init() {
        val videoUrl: String = intent.getStringExtra("videoUrl")?:""

        val video: SampleCoverVideo = binding.video
        video.setUpLazy(videoUrl, true, null, null, "")
        video.isAutoFullWithSize = false
        video.setIsTouchWiget(false)
        video.fullscreenButton.visibility = View.GONE
        video.backButton.visibility = View.GONE
        video.isLooping = true
        video.startPlayLogic()
    }

    public override fun onPause() {
        super.onPause()
        GSYVideoManager.onPause()
    }

    override fun onDestroy() {
        super.onDestroy()
        GSYVideoManager.releaseAllVideos()
    }
}